﻿@using Smartstore.Admin.Models.Logging

@model LogModel

<datagrid id="log-grid" allow-resize="true" allow-row-selection="true" allow-column-reordering="true">
    <datasource read="@Url.Action("LogList")" delete="@Url.Action("LogDelete")" />
    <paging position="Bottom" show-size-chooser="true" />
    <sorting enabled="true" allow-unsort="true" allow-multisort="false">
        <sort by="CreatedOn" descending="true" />
    </sorting>
    <toolbar>
        <toolbar-group>
            <button datagrid-action="DataGridToolAction.ToggleSearchPanel" class="btn btn-light btn-icon">
                <i class="fa fa-fw fa-filter"></i>
            </button>
        </toolbar-group>
        <zone name="datagrid_toolbar_alpha"></zone>
        <toolbar-group class="omega"></toolbar-group>
        <zone name="datagrid_toolbar_omega"></zone>
        <toolbar-group>
            <button datagrid-action="DataGridToolAction.DeleteSelectedRows" type="button" class="btn btn-danger btn-flat">
                <i class="far fa-trash-alt"></i>
                <span>@T("Admin.Common.Delete.Selected")</span>
            </button>
        </toolbar-group>
    </toolbar>
    <search-panel>
        <partial name="_Grid.Logs.Search" model="new LogListModel()" />
    </search-panel>
    <columns>
        <column for="Id" visible="false" type="string" />
        <column for="Logger" width="250px">
            <display-template>
                <span class="text-muted text-truncate" :title="item.value">{{ item.row.LoggerShort }}</span>
            </display-template>
        </column>
        <column for="ShortMessage" hideable="false">
            <display-template>
                <span :class="'mr-1 level-badge badge badge-' + item.row.LogLevelHint">{{ item.row.LogLevel }}</span>
                <a :href="item.row.ViewUrl" class="text-truncate">
                    {{ item.value }}
                </a>
            </display-template>
        </column>
        <column for="UserName" width="max-content" />
        <column for="CreatedOn" entity-member="CreatedOnUtc" />
    </columns>
</datagrid>